home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Text⁄Files
/
Writeswell Jr. 1.0.2 Master
/
Writeswell Jr. Source
/
InitWWJr.c
< prev
next >
Wrap
Text File
|
1992-10-23
|
3KB
|
121 lines
/* InitWWJr.c
* Initialization code for Writeswell Jr.
*
* ©1992 Working Software, Inc.
* This source code is copyrighted. Permission is granted to use the Word Services
* portion of the Writeswell Jr. source code in your own programs, but you
* may not distribute the Writeswell Jr. word-processor code as a
* commercial product. If you modify the code, please do not call it
* Writeswell Jr. (or Writeswell.) This will ensure that people understand the
* program and don’t have to deal with a number of different versions with
* who-knows-what going on in the code.
*
* Writeswell Jr. and Writeswell are trademarks of Working Software, Inc.
*/
#include <EPPC.h>
#include <AppleEvents.h>
#include "GenHandlers.h"
#include "AppEvents.h"
#include "InitMenu.h"
#include "Gripe.h"
#include "AEObj.h"
#include "MyFiles.h"
#include "InitWWJr.h"
OSErr CheckApplParams( SFReply *replyPtr );
OSErr InitForSystem7( void )
{
OSErr err;
PutUpSys7Menus();
if ( err = InitReqHandlers() )
return err;
if ( err = InitGenericHandlers() )
return err;
if ( err = InitAEObjStuff() )
return err;
return noErr;
}
OSErr InitForSystem6( void )
{
OSErr err;
SFReply reply;
PutUpSys6Menus();
CheckApplParams( &reply );
if ( reply.good ){
err = MyOpenSfFile( &reply );
}else{
err = MakeNewWindow();
}
return err;
}
OSErr CheckApplParams( SFReply *replyPtr )
{
short message;
short count;
short i;
AppFile file;
short vRef;
ParamBlockRec fPB;
OSErr err;
replyPtr->good = false;
CountAppFiles(&message,&count);
if (!count)
return noErr;
err = GetVol(0L,&vRef);
if ( err ){
Gripe( "\pGetVol failed" );
return err;
}
/* Loop through all the files that were selected on the desktop,
skipping all that don't have a type of 'TEXT' */
for (i = 1; i <= count; i++)
{
GetAppFiles(i, &file);
/* If it’s not a file type we can open, skip it */
if (file.fType == 'TEXT' )
{
fPB.fileParam.ioCompletion = (ProcPtr)NULL;
fPB.fileParam.ioNamePtr = (StringPtr)NULL;
fPB.fileParam.ioVRefNum = file.vRefNum;
err = PBSetVol( &fPB, false );
if ( err ){
Gripe( "\pPBSetVol failed in MyOpenSpecFile" );
return err;
}
replyPtr->vRefNum = file.vRefNum;
replyPtr->fType = file.fType;
replyPtr->version = file.versNum;
BlockMove( file.fName, replyPtr->fName, (file.fName)[0] + 1 );
replyPtr->copy = false;
replyPtr->good = true;
return noErr;
}
ClrAppFiles(i);
}
return noErr;
}